<?php
/*
	Version   :  1.0
	Created   :  20081108
	Modified  :  --
	Author    :  Pablo Ramírez
	co-Author :
	Descr     : Modelo de Entidad "Order Containers"
	Changelog :
*/
class OrderContainer extends AppModel
{
	var $name       = 'OrderContainer';
	//var $useTable   = 'order_containers';
	var $id         = 'oco_id'; //lo acabo de descomentar y cambiar de cod codigo a oco_id
	var $primaryKey = 'oco_id'; //lo acabo de cambiar de cod codigo a oco id
	var $transactional = true;
	
	function getContainersForReport($ord_codigo, $set_codigo) {
		$results = $this->findAll("OrderContainer.ord_codigo = '$ord_codigo' and 
								   OrderContainer.set_codigo = '$set_codigo'", //conditions
								   array(), //fields
								   'OrderContainer.cod_codigo ASC', //order
								   null, //limit
								   null, //page
								   -1    //recursive
								   );
		return $results;	
	}
	
	function getContainersForReport2($ord_codigo) {
		$results = $this->findAll("OrderContainer.ord_codigo = '$ord_codigo'", //conditions
								   array(), //fields
								   'OrderContainer.cot_codigo ASC, OrderContainer.set_codigo ASC', //order
								   null, //limit
								   null, //page
								   -1    //recursive
								   );
		return $results;
	}
	
	function getServicesForResume($ord_codigo, $dep_codigo) {
		$results = $this->query("select dep_codigo, set_codigo, count(*) as q 
								 from order_containers where 
								 ord_codigo = '$ord_codigo' and 
								 dep_codigo = '$dep_codigo'
								 group by set_codigo"); 
		return $results;
	}
}
?>